<template>
  <div class="group">
    <div class="item" v-for="item of group" :key="item._id">
      <img class="img" @click="goDetail(item._id)" :src="item.img" alt="">
      <div class="info">
        <p class="name">{{item.name}}</p>
        <p class="detail">{{item.detail}}</p>
      </div>
    </div>
  </div>
</template>

<script>
import KeyboardHttp from '../../../models/KeyboardHttp.js'
export default {
  data() {
    return {
      group:[]
    }
  },
  async mounted(){
    try {
      var res = await KeyboardHttp.getGroup()
      this.group = res.data.res
    }catch(err){
      console.log(err);
    }
  }
}
</script>

<style scoped>
  .group{
    height: 412px;
    width: 360px;
    overflow-y: scroll;
    direction:rtl;
  }
  .item{
    margin: 20px;
    display: flex;
    flex-direction: row-reverse;
  }
  .item:first-child{
    margin-top: 0;
  }
  .item:last-child{
    margin-bottom: 0;
  }
  .img{
    width: 140px;
    height: 95px;
    object-fit: cover;
    cursor: pointer;
  }
  .info{
    margin-left: 6px;
    cursor: pointer;
  }
  ::-webkit-scrollbar{
    width: 4px;	/*高宽分别对应横竖滚动条的尺寸*/
    height: 4px;
    scrollbar-arrow-color: red;
    direction: ltr;
  }
  ::-webkit-scrollbar-thumb{
    /*滚动条里面小方块*/
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 5px rgb(255, 255, 255);
    background: rgba(0, 0, 0, 0.2);
    scrollbar-arrow-color: red;
  }
  ::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    -webkit-box-shadow: inset 0 0 5px rgba(180, 178, 178, 0.2);
    border-radius: 3px;
    background: rgba(104, 101, 101, 0.1);
  }
  .name{
    font-size: 14px;
    text-align: left;
  }
  .detail{
    font-size: 12px;
    text-align: left;
    color: #666;
    margin-top: 5px;
  }
</style>